<? $tietol='Xem lịch sân'; ?>
<? include("popup_top.php"); ?>
<script>
	kiem_trthongtin(1080);
</script>
<style>
.show_info_2{
	font-size:11px;
	position:relative;
	text-align:center;
	width:1080px;
	color:#000;
}

.tbl_schedule
{
	text-align:center;
	margin:10px;
	font-size:11px;
	border-collapse:collapse;
}

.tbl_schedule th
{
	background:#019e04;
	color:#fff;
	padding:7px;
	font-size:12px;
}

.tbl_schedule td
{
	border:1px solid #aaa;
}

.tbl_schedule td.inactive
{
	cursor:pointer;
	color:#000;
}

.tbl_schedule td.inactive:hover
{
	background:#019e04;
	color:#fff;
}

.tbl_schedule td.active
{
	background:#c00;
	color:#fff;
}

.tbl_schedule th
{
	border:1px solid #fff;
}
</style> 

<table cellpadding="5" cellspacing="0" width="1042" class='tbl_schedule' rel="<?php echo $ground_id; ?>">
	<tr>
    	<th></th>
        <?
		foreach ($schedules as $schedule)
		{
			echo "<th>".$schedule['schedule']."</th>";
		}
		?>
    </tr>
	<?
	
	$now = time();
	for ($i = 0; $i < 7; $i++)
	{
		echo "<tr rel='".$dates[$i]."'>";
		echo "<th>".$dates[$i]."</th>";
		
		foreach ($scheduleChecked[$i] as $schedule)
		{
			$cost = $schedule['cost'];
			$time = $now + $i*3600*24;
			if ($schedule['cost_weekend'] + 0 != 0)
				if (date('N',$time) >= 6)
					$cost = $schedule['cost_weekend'];
			$cost = round($cost * (100 - $schedule['promotion']) / 100);
			echo "<td rel='".$schedule['schedule']."' class='".(($schedule['statusTemp'])?"active":"inactive")."'>".$cost." VNĐ</td>";
		}
		echo "</tr>";
	}
    ?>
</table>
<?php
if ($schedule['promotion'] + 0 != 0)
{
?>
<div style='padding:10px 0; text-align:center;'>
	<span style='text-decoration:blink; color:#c00; font-weight:bold; font-size:14px;'>Khuyến mãi <?php echo $schedule['promotion']?> %</span>
</div>
<?php
}
?>
<script>
	$(".tbl_schedule td").click(function()
	{
		if ($(this).hasClass('inactive'))
		{
			var ground_id = $(".tbl_schedule").attr('rel');
			var schedule = $(this).attr('rel');
			var date = $(this).parent().attr('rel');
			
			$.ajax({
				url:'/web/frontend.php/ajax/show_form.html',
				type: 'POST',
				data: 'ground_id=' + ground_id + '&schedule=' + schedule + '&date=' + date,
				dataType: "html",
				success: function(data){
					showResult("luu_result",data);
				}
			});
		}
	});
</script>
<? include("popup_button.php"); ?>